package com.crm.controller.saling;

import com.crm.service.saling.BackService;
import com.crm.vo.BackClientContractUserInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by dr5hx on 2018/8/31
 */
@Controller
public class BackController {
    @Autowired
    private BackService backService;

    @GetMapping("toBackClientContractUserInfoVOList")
    public String toBackClientContractUserInfoVOList() {
        return "saling/backList";
    }


    @PostMapping("getBackClientContractUserInfoVOList")
    @ResponseBody
    public Map getBackClientContractUserInfoVOList(int page, int rows) {
        try {
            List<BackClientContractUserInfoVO> list = backService.getBackClientContractUserInfoVOList(page, rows);
            Long count = backService.getBackCount();
            Map map = new HashMap();
            map.put("rows", list);
            map.put("total", count);
            return map;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    }


}
